package com.htc.android.footprints.kml;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Reader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;

import com.htc.android.footprints.utils.FootprintUtils;
import com.htc.android.footprints.utils.camera.FootprintImageManager;
import com.htc.android.footprints.utils.voice.FootprintVoiceManager;
import com.htc.android.footprints.vo.Footprint;

public class KMLUtil
{
  private static final String TAG = "KMLUtil";
  private static final String TAG_ADDRESS = "address";
  private static final String TAG_COORDINATES = "coordinates";
  private static final String TAG_DESCRIPTION = "description";
  private static final String TAG_Data = "Data";
  private static final String TAG_NAME = "name";
  private static final String TAG_PHONENUMBER = "phoneNumber";
  private static final String TAG_PLACEMARK = "Placemark";
  private static final String TAG_TimeStamp = "TimeStamp";
  private static final String TAG_VALUE = "value";
  private static final String TAG_WHEN = "when";
  private static OnProgressListener mListener;
  private static SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'");

  public static KMLDocument convertKML(Footprint[] paramArrayOfFootprint)
  {
    KMLDocument localKMLDocument = new KMLDocument();
    ArrayList localArrayList = new ArrayList(paramArrayOfFootprint.length);
    int i = paramArrayOfFootprint.length;
    int j = 0;
    if (j < i)
    {
      Footprint localFootprint = paramArrayOfFootprint[j];
      KMLPlacemark localKMLPlacemark = new KMLPlacemark();
      localKMLPlacemark.name = localFootprint.mName;
      localKMLPlacemark.address = localFootprint.mAddr;
      localKMLPlacemark.when = localFootprint.mCreateTime;
      localKMLPlacemark.phoneNumber = localFootprint.mTel;
      localKMLPlacemark.latitudeE6 = localFootprint.mLatitude;
      localKMLPlacemark.longitudeE6 = localFootprint.mLongitude;
      localKMLPlacemark.setTextDescription(localFootprint.mComment);
      localKMLPlacemark.setExtendData("create_time", String.valueOf(localFootprint.mCreateTime));
      localKMLPlacemark.setExtendData("footprintid", FootprintUtils.generateMD5(String.valueOf(localKMLPlacemark.when)));
      if (localFootprint.mComment != null)
        localKMLPlacemark.setExtendData("comment", localFootprint.mComment);
      while (true)
      {
        localKMLPlacemark.setExtendData("accuracy", String.valueOf(localFootprint.mAccuracy));
        localKMLPlacemark.setExtendData("version", String.valueOf(localFootprint.mVersion));
        if (localFootprint.mAudioFileName != null)
          localKMLPlacemark.setExtendData("audio", localFootprint.mAudioFileName);
        localKMLPlacemark.setExtendData("rate", String.valueOf(localFootprint.mRate));
        if (localFootprint.mSite != null)
          localKMLPlacemark.setExtendData("website", localFootprint.mSite);
        if (localFootprint.mCategory != null)
          localKMLPlacemark.setExtendData("category", localFootprint.mCategory);
        if (localFootprint.mPicFileName != null)
          localKMLPlacemark.setExtendData("image", localFootprint.mPicFileName);
        localArrayList.add(localKMLPlacemark);
        j++;
        break;
        localKMLPlacemark.setExtendData("comment", "");
      }
    }
    localKMLDocument.placemarksList = localArrayList;
    return localKMLDocument;
  }

  public static void exportKMZ(Footprint[] paramArrayOfFootprint, OutputStream paramOutputStream)
  {
    HashSet localHashSet1 = new HashSet();
    HashSet localHashSet2 = new HashSet();
    int i = paramArrayOfFootprint.length;
    for (int j = 0; j < i; j++)
    {
      Footprint localFootprint = paramArrayOfFootprint[j];
      if ((localFootprint.mPicPath != null) && (!localFootprint.mPicPath.equals("")))
        localHashSet1.add(new File(localFootprint.mPicPath));
      if ((localFootprint.mAudioPath == null) || (localFootprint.mAudioPath.equals("")))
        continue;
      localHashSet2.add(new File(localFootprint.mAudioPath));
    }
    File[] arrayOfFile1 = (File[])localHashSet1.toArray(new File[localHashSet1.size()]);
    File[] arrayOfFile2 = (File[])localHashSet2.toArray(new File[localHashSet2.size()]);
    if (mListener != null)
      mListener.onProgress(10);
    writeToKMZ(convertKML(paramArrayOfFootprint), paramOutputStream, arrayOfFile1, arrayOfFile2);
    if (mListener != null)
      mListener.onEnd();
  }

  public static String getDirectory()
  {
    return FootprintImageManager.getExternalStorageDirectory() + File.separator + "footprint_export_files";
  }

  public static String getOuputFile(String paramString)
  {
    return FootprintImageManager.getExternalStorageDirectory() + File.separator + "footprint_export_files" + File.separator + paramString + ".kmz";
  }

  // ERROR //
  public static Footprint[] importKMZ(java.io.InputStream paramInputStream)
  {
    // Byte code:
    //   0: new 260	java/util/zip/ZipInputStream
    //   3: dup
    //   4: new 262	java/io/BufferedInputStream
    //   7: dup
    //   8: aload_0
    //   9: invokespecial 265	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   12: invokespecial 266	java/util/zip/ZipInputStream:<init>	(Ljava/io/InputStream;)V
    //   15: astore_1
    //   16: iconst_0
    //   17: anewarray 75	com/htc/android/footprints/vo/Footprint
    //   20: astore_2
    //   21: sipush 4096
    //   24: newarray byte
    //   26: astore 14
    //   28: aload_1
    //   29: invokevirtual 270	java/util/zip/ZipInputStream:getNextEntry	()Ljava/util/zip/ZipEntry;
    //   32: astore 15
    //   34: aload 15
    //   36: ifnull +328 -> 364
    //   39: aload 15
    //   41: invokevirtual 275	java/util/zip/ZipEntry:getName	()Ljava/lang/String;
    //   44: ldc_w 277
    //   47: invokevirtual 196	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   50: ifeq +28 -> 78
    //   53: new 279	java/io/BufferedReader
    //   56: dup
    //   57: new 281	java/io/InputStreamReader
    //   60: dup
    //   61: aload_1
    //   62: ldc_w 283
    //   65: invokespecial 286	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;Ljava/lang/String;)V
    //   68: invokespecial 289	java/io/BufferedReader:<init>	(Ljava/io/Reader;)V
    //   71: invokestatic 293	com/htc/android/footprints/kml/KMLUtil:parseKML	(Ljava/io/Reader;)[Lcom/htc/android/footprints/vo/Footprint;
    //   74: astore_2
    //   75: goto -47 -> 28
    //   78: aload 15
    //   80: invokevirtual 275	java/util/zip/ZipEntry:getName	()Ljava/lang/String;
    //   83: invokevirtual 296	java/lang/String:toLowerCase	()Ljava/lang/String;
    //   86: ldc_w 298
    //   89: invokevirtual 302	java/lang/String:endsWith	(Ljava/lang/String;)Z
    //   92: ifeq +158 -> 250
    //   95: new 304	java/io/FileOutputStream
    //   98: dup
    //   99: new 231	java/lang/StringBuilder
    //   102: dup
    //   103: invokespecial 232	java/lang/StringBuilder:<init>	()V
    //   106: invokestatic 306	com/htc/android/footprints/utils/camera/FootprintImageManager:getDirectory	()Ljava/lang/String;
    //   109: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   112: getstatic 244	java/io/File:separator	Ljava/lang/String;
    //   115: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   118: aload 15
    //   120: invokevirtual 275	java/util/zip/ZipEntry:getName	()Ljava/lang/String;
    //   123: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   126: invokevirtual 249	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   129: invokespecial 307	java/io/FileOutputStream:<init>	(Ljava/lang/String;)V
    //   132: astore 18
    //   134: aload_1
    //   135: aload 14
    //   137: invokevirtual 311	java/util/zip/ZipInputStream:read	([B)I
    //   140: istore 19
    //   142: iload 19
    //   144: ifle +41 -> 185
    //   147: aload 18
    //   149: aload 14
    //   151: iconst_0
    //   152: iload 19
    //   154: invokevirtual 315	java/io/FileOutputStream:write	([BII)V
    //   157: goto -23 -> 134
    //   160: astore 10
    //   162: ldc 12
    //   164: aload 10
    //   166: invokevirtual 318	java/io/IOException:getMessage	()Ljava/lang/String;
    //   169: aload 10
    //   171: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   174: pop
    //   175: aload_1
    //   176: ifnull +7 -> 183
    //   179: aload_1
    //   180: invokevirtual 327	java/util/zip/ZipInputStream:close	()V
    //   183: aload_2
    //   184: areturn
    //   185: aload 18
    //   187: invokevirtual 330	java/io/FileOutputStream:flush	()V
    //   190: aload 18
    //   192: invokevirtual 334	java/io/FileOutputStream:getFD	()Ljava/io/FileDescriptor;
    //   195: invokevirtual 339	java/io/FileDescriptor:sync	()V
    //   198: aload 18
    //   200: invokevirtual 340	java/io/FileOutputStream:close	()V
    //   203: goto -175 -> 28
    //   206: astore 6
    //   208: ldc 12
    //   210: aload 6
    //   212: invokevirtual 341	org/xmlpull/v1/XmlPullParserException:getMessage	()Ljava/lang/String;
    //   215: aload 6
    //   217: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   220: pop
    //   221: aload_1
    //   222: ifnull -39 -> 183
    //   225: aload_1
    //   226: invokevirtual 327	java/util/zip/ZipInputStream:close	()V
    //   229: goto -46 -> 183
    //   232: astore 8
    //   234: ldc 12
    //   236: aload 8
    //   238: invokevirtual 318	java/io/IOException:getMessage	()Ljava/lang/String;
    //   241: aload 8
    //   243: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   246: pop
    //   247: goto -64 -> 183
    //   250: aload 15
    //   252: invokevirtual 275	java/util/zip/ZipEntry:getName	()Ljava/lang/String;
    //   255: invokevirtual 296	java/lang/String:toLowerCase	()Ljava/lang/String;
    //   258: ldc_w 343
    //   261: invokevirtual 302	java/lang/String:endsWith	(Ljava/lang/String;)Z
    //   264: ifeq -236 -> 28
    //   267: new 304	java/io/FileOutputStream
    //   270: dup
    //   271: new 231	java/lang/StringBuilder
    //   274: dup
    //   275: invokespecial 232	java/lang/StringBuilder:<init>	()V
    //   278: invokestatic 346	com/htc/android/footprints/utils/voice/FootprintVoiceManager:getDirectory	()Ljava/lang/String;
    //   281: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   284: getstatic 244	java/io/File:separator	Ljava/lang/String;
    //   287: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   290: aload 15
    //   292: invokevirtual 275	java/util/zip/ZipEntry:getName	()Ljava/lang/String;
    //   295: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   298: invokevirtual 249	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   301: invokespecial 307	java/io/FileOutputStream:<init>	(Ljava/lang/String;)V
    //   304: astore 20
    //   306: aload_1
    //   307: aload 14
    //   309: invokevirtual 311	java/util/zip/ZipInputStream:read	([B)I
    //   312: istore 21
    //   314: iload 21
    //   316: ifle +27 -> 343
    //   319: aload 20
    //   321: aload 14
    //   323: iconst_0
    //   324: iload 21
    //   326: invokevirtual 315	java/io/FileOutputStream:write	([BII)V
    //   329: goto -23 -> 306
    //   332: astore_3
    //   333: aload_1
    //   334: ifnull +7 -> 341
    //   337: aload_1
    //   338: invokevirtual 327	java/util/zip/ZipInputStream:close	()V
    //   341: aload_3
    //   342: athrow
    //   343: aload 20
    //   345: invokevirtual 330	java/io/FileOutputStream:flush	()V
    //   348: aload 20
    //   350: invokevirtual 334	java/io/FileOutputStream:getFD	()Ljava/io/FileDescriptor;
    //   353: invokevirtual 339	java/io/FileDescriptor:sync	()V
    //   356: aload 20
    //   358: invokevirtual 340	java/io/FileOutputStream:close	()V
    //   361: goto -333 -> 28
    //   364: aload_1
    //   365: ifnull -182 -> 183
    //   368: aload_1
    //   369: invokevirtual 327	java/util/zip/ZipInputStream:close	()V
    //   372: goto -189 -> 183
    //   375: astore 16
    //   377: ldc 12
    //   379: aload 16
    //   381: invokevirtual 318	java/io/IOException:getMessage	()Ljava/lang/String;
    //   384: aload 16
    //   386: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   389: pop
    //   390: goto -207 -> 183
    //   393: astore 12
    //   395: ldc 12
    //   397: aload 12
    //   399: invokevirtual 318	java/io/IOException:getMessage	()Ljava/lang/String;
    //   402: aload 12
    //   404: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   407: pop
    //   408: goto -225 -> 183
    //   411: astore 4
    //   413: ldc 12
    //   415: aload 4
    //   417: invokevirtual 318	java/io/IOException:getMessage	()Ljava/lang/String;
    //   420: aload 4
    //   422: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   425: pop
    //   426: goto -85 -> 341
    //
    // Exception table:
    //   from	to	target	type
    //   21	157	160	java/io/IOException
    //   185	203	160	java/io/IOException
    //   250	329	160	java/io/IOException
    //   343	361	160	java/io/IOException
    //   21	157	206	org/xmlpull/v1/XmlPullParserException
    //   185	203	206	org/xmlpull/v1/XmlPullParserException
    //   250	329	206	org/xmlpull/v1/XmlPullParserException
    //   343	361	206	org/xmlpull/v1/XmlPullParserException
    //   225	229	232	java/io/IOException
    //   21	157	332	finally
    //   162	175	332	finally
    //   185	203	332	finally
    //   208	221	332	finally
    //   250	329	332	finally
    //   343	361	332	finally
    //   368	372	375	java/io/IOException
    //   179	183	393	java/io/IOException
    //   337	341	411	java/io/IOException
  }

  public static Footprint[] parseKML(Reader paramReader)
    throws XmlPullParserException, IOException
  {
    ArrayList localArrayList = new ArrayList();
    XmlPullParser localXmlPullParser = XmlPullParserFactory.newInstance().newPullParser();
    localXmlPullParser.setInput(paramReader);
    int i = 0;
    boolean bool1 = false;
    boolean bool2 = false;
    boolean bool3 = false;
    boolean bool4 = false;
    boolean bool5 = false;
    int j = 0;
    boolean bool6 = false;
    boolean bool7 = false;
    boolean bool8 = false;
    int k = localXmlPullParser.getEventType();
    Footprint localFootprint = null;
    String str1 = null;
    if (k == 0);
    do
    {
      k = localXmlPullParser.next();
      if (k != 1)
        break;
      return (Footprint[])localArrayList.toArray(new Footprint[localArrayList.size()]);
    }
    while (k == 1);
    String str12;
    int i4;
    int i5;
    boolean bool9;
    boolean bool10;
    boolean bool11;
    boolean bool12;
    boolean bool13;
    boolean bool14;
    boolean bool15;
    boolean bool16;
    if (k == 2)
    {
      str12 = localXmlPullParser.getName();
      if (str12.equals("Placemark"))
      {
        i4 = 1;
        localFootprint = new Footprint();
        localArrayList.add(localFootprint);
        i5 = j;
        bool9 = bool2;
        bool10 = bool5;
        bool11 = bool6;
        bool12 = bool8;
        bool13 = bool7;
        bool14 = bool3;
        bool15 = bool1;
        bool16 = bool4;
      }
    }
    while (true)
    {
      bool4 = bool16;
      bool1 = bool15;
      bool3 = bool14;
      bool7 = bool13;
      bool8 = bool12;
      bool6 = bool11;
      bool5 = bool10;
      bool2 = bool9;
      j = i5;
      i = i4;
      break;
      if ((str12.equals("name")) && (i != 0))
      {
        str1 = "name";
        i4 = i;
        i5 = j;
        bool9 = bool2;
        bool10 = bool5;
        bool11 = bool6;
        bool12 = bool8;
        bool13 = bool7;
        bool14 = bool3;
        bool15 = bool1;
        bool16 = bool4;
        continue;
      }
      if ((str12.equals("description")) && (i != 0))
      {
        str1 = "description";
        i4 = i;
        i5 = j;
        bool9 = bool2;
        bool10 = bool5;
        bool11 = bool6;
        bool12 = bool8;
        bool13 = bool7;
        bool14 = bool3;
        bool15 = bool1;
        bool16 = bool4;
        continue;
      }
      if ((str12.equals("coordinates")) && (i != 0))
      {
        str1 = "coordinates";
        i4 = i;
        i5 = j;
        bool9 = bool2;
        bool10 = bool5;
        bool11 = bool6;
        bool12 = bool8;
        bool13 = bool7;
        bool14 = bool3;
        bool15 = bool1;
        bool16 = bool4;
        continue;
      }
      if ((str12.equals("address")) && (i != 0))
      {
        str1 = "address";
        i4 = i;
        i5 = j;
        bool9 = bool2;
        bool10 = bool5;
        bool11 = bool6;
        bool12 = bool8;
        bool13 = bool7;
        bool14 = bool3;
        bool15 = bool1;
        bool16 = bool4;
        continue;
      }
      if ((str12.equals("phoneNumber")) && (i != 0))
      {
        str1 = "phoneNumber";
        i4 = i;
        i5 = j;
        bool9 = bool2;
        bool10 = bool5;
        bool11 = bool6;
        bool12 = bool8;
        bool13 = bool7;
        bool14 = bool3;
        bool15 = bool1;
        bool16 = bool4;
        continue;
      }
      if ((str12.equals("TimeStamp")) && (i != 0))
      {
        str1 = "TimeStamp";
        i4 = i;
        i5 = j;
        bool9 = bool2;
        bool10 = bool5;
        bool11 = bool6;
        bool12 = bool8;
        bool13 = bool7;
        bool14 = bool3;
        bool15 = bool1;
        bool16 = bool4;
        continue;
      }
      if ((str12.equals("when")) && (i != 0))
      {
        if (str1 == "TimeStamp")
        {
          str1 = "when";
          i4 = i;
          i5 = j;
          bool9 = bool2;
          bool10 = bool5;
          bool11 = bool6;
          bool12 = bool8;
          bool13 = bool7;
          bool14 = bool3;
          bool15 = bool1;
          bool16 = bool4;
          continue;
        }
      }
      else
      {
        if ((str12.equals("Data")) && (i != 0))
        {
          bool15 = localXmlPullParser.getAttributeValue(0).equals("rate");
          bool9 = localXmlPullParser.getAttributeValue(0).equals("audio");
          bool14 = localXmlPullParser.getAttributeValue(0).equals("image");
          bool16 = localXmlPullParser.getAttributeValue(0).equals("website");
          bool11 = localXmlPullParser.getAttributeValue(0).equals("comment");
          bool10 = localXmlPullParser.getAttributeValue(0).equals("category");
          boolean bool17 = localXmlPullParser.getAttributeValue(0).equals("accuracy");
          bool12 = localXmlPullParser.getAttributeValue(0).equals("create_time");
          bool13 = localXmlPullParser.getAttributeValue(0).equals("create_time");
          i4 = i;
          i5 = bool17;
          continue;
        }
        if (!str12.equals("value"))
          break label1428;
        if (i != 0)
        {
          str1 = "value";
          i4 = i;
          i5 = j;
          bool9 = bool2;
          bool10 = bool5;
          bool11 = bool6;
          bool12 = bool8;
          bool13 = bool7;
          bool14 = bool3;
          bool15 = bool1;
          bool16 = bool4;
          continue;
          if (k == 3)
          {
            if (localXmlPullParser.getName().equals("Placemark"));
            for (int i3 = 0; ; i3 = i)
            {
              i = i3;
              break;
              str1 = null;
            }
          }
          if (k != 4)
            break;
          if (str1 == "name")
          {
            String str11 = localXmlPullParser.getText();
            localFootprint.mName = str11;
            break;
          }
          if (str1 == "description")
            break;
          if (str1 == "coordinates")
          {
            int i1 = (int)(1000000.0D * Double.valueOf(localXmlPullParser.getText().split(",")[0]).doubleValue());
            localFootprint.mLongitude = i1;
            int i2 = (int)(1000000.0D * Double.valueOf(localXmlPullParser.getText().split(",")[1]).doubleValue());
            localFootprint.mLatitude = i2;
            break;
          }
          if (str1 == "address")
          {
            String str10 = localXmlPullParser.getText();
            localFootprint.mAddr = str10;
            break;
          }
          if (str1 == "phoneNumber")
          {
            String str9 = localXmlPullParser.getText();
            localFootprint.mTel = str9;
            break;
          }
          if ((str1 == "when") || (str1 != "value"))
            break;
          if (bool1)
          {
            int n = Integer.parseInt(localXmlPullParser.getText());
            localFootprint.mRate = n;
            break;
          }
          if (bool2)
          {
            String str7 = localXmlPullParser.getText();
            localFootprint.mAudioFileName = str7;
            if (localFootprint.mAudioFileName.equals(""))
              break;
            String str8 = FootprintVoiceManager.getDirectory() + File.separator + localFootprint.mAudioFileName;
            localFootprint.mAudioPath = str8;
            break;
          }
          if (bool3)
          {
            String str5 = localXmlPullParser.getText();
            localFootprint.mPicFileName = str5;
            if (localFootprint.mPicFileName.equals(""))
              break;
            String str6 = FootprintImageManager.getDirectory() + File.separator + localFootprint.mPicFileName;
            localFootprint.mPicPath = str6;
            break;
          }
          if (bool4)
          {
            String str4 = localXmlPullParser.getText();
            localFootprint.mSite = str4;
            break;
          }
          if (bool6)
          {
            String str3 = localXmlPullParser.getText();
            localFootprint.mComment = str3;
            break;
          }
          if (bool5)
          {
            String str2 = localXmlPullParser.getText();
            localFootprint.mCategory = str2;
            break;
          }
          if (j != 0)
          {
            int m = Integer.parseInt(localXmlPullParser.getText());
            localFootprint.mAccuracy = m;
            break;
          }
          if (bool8)
          {
            long l = Long.parseLong(localXmlPullParser.getText());
            localFootprint.mCreateTime = l;
            break;
          }
          if (!bool7)
            break;
          break;
        }
      }
      i4 = i;
      i5 = j;
      bool9 = bool2;
      bool10 = bool5;
      bool11 = bool6;
      bool12 = bool8;
      bool13 = bool7;
      bool14 = bool3;
      bool15 = bool1;
      bool16 = bool4;
      continue;
      label1428: i4 = i;
      i5 = j;
      bool9 = bool2;
      bool10 = bool5;
      bool11 = bool6;
      bool12 = bool8;
      bool13 = bool7;
      bool14 = bool3;
      bool15 = bool1;
      bool16 = bool4;
    }
  }

  public static void setProgressListener(OnProgressListener paramOnProgressListener)
  {
    mListener = paramOnProgressListener;
  }

  // ERROR //
  public static void writeToKMZ(KMLDocument paramKMLDocument, OutputStream paramOutputStream, File[] paramArrayOfFile1, File[] paramArrayOfFile2)
  {
    // Byte code:
    //   0: new 417	java/util/zip/ZipOutputStream
    //   3: dup
    //   4: aload_1
    //   5: invokespecial 420	java/util/zip/ZipOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   8: astore 4
    //   10: aload 4
    //   12: new 272	java/util/zip/ZipEntry
    //   15: dup
    //   16: ldc_w 277
    //   19: invokespecial 421	java/util/zip/ZipEntry:<init>	(Ljava/lang/String;)V
    //   22: invokevirtual 425	java/util/zip/ZipOutputStream:putNextEntry	(Ljava/util/zip/ZipEntry;)V
    //   25: new 427	java/io/StringReader
    //   28: dup
    //   29: new 119	java/lang/String
    //   32: dup
    //   33: aload_0
    //   34: invokevirtual 428	com/htc/android/footprints/kml/KMLDocument:toString	()Ljava/lang/String;
    //   37: invokevirtual 432	java/lang/String:getBytes	()[B
    //   40: ldc_w 283
    //   43: invokespecial 435	java/lang/String:<init>	([BLjava/lang/String;)V
    //   46: invokespecial 436	java/io/StringReader:<init>	(Ljava/lang/String;)V
    //   49: astore 23
    //   51: new 438	java/io/OutputStreamWriter
    //   54: dup
    //   55: aload 4
    //   57: ldc_w 283
    //   60: invokespecial 441	java/io/OutputStreamWriter:<init>	(Ljava/io/OutputStream;Ljava/lang/String;)V
    //   63: astore 24
    //   65: sipush 8192
    //   68: invokestatic 447	java/nio/CharBuffer:allocate	(I)Ljava/nio/CharBuffer;
    //   71: astore 25
    //   73: aload 23
    //   75: aload 25
    //   77: invokevirtual 450	java/io/StringReader:read	(Ljava/nio/CharBuffer;)I
    //   80: istore 26
    //   82: iload 26
    //   84: bipush 255
    //   86: if_icmpeq +98 -> 184
    //   89: aload 25
    //   91: invokevirtual 454	java/nio/CharBuffer:flip	()Ljava/nio/Buffer;
    //   94: pop
    //   95: aload 24
    //   97: aload 25
    //   99: invokevirtual 458	java/nio/CharBuffer:array	()[C
    //   102: aload 25
    //   104: invokevirtual 461	java/nio/CharBuffer:arrayOffset	()I
    //   107: aload 25
    //   109: invokevirtual 464	java/nio/CharBuffer:length	()I
    //   112: invokevirtual 467	java/io/OutputStreamWriter:write	([CII)V
    //   115: aload 25
    //   117: invokevirtual 470	java/nio/CharBuffer:clear	()Ljava/nio/Buffer;
    //   120: pop
    //   121: goto -48 -> 73
    //   124: astore 12
    //   126: aload 4
    //   128: astore 13
    //   130: ldc 12
    //   132: aload 12
    //   134: invokevirtual 471	java/lang/Exception:getMessage	()Ljava/lang/String;
    //   137: aload 12
    //   139: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   142: pop
    //   143: aload 13
    //   145: ifnull +13 -> 158
    //   148: aload 13
    //   150: invokevirtual 472	java/util/zip/ZipOutputStream:flush	()V
    //   153: aload 13
    //   155: invokevirtual 473	java/util/zip/ZipOutputStream:close	()V
    //   158: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   161: ifnull +783 -> 944
    //   164: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   167: bipush 100
    //   169: invokeinterface 218 2 0
    //   174: ldc2_w 474
    //   177: invokestatic 481	java/lang/Thread:sleep	(J)V
    //   180: aload 13
    //   182: pop
    //   183: return
    //   184: aload 24
    //   186: invokevirtual 482	java/io/OutputStreamWriter:flush	()V
    //   189: aload 23
    //   191: invokevirtual 483	java/io/StringReader:close	()V
    //   194: iconst_0
    //   195: istore 27
    //   197: aload_3
    //   198: ifnull +40 -> 238
    //   201: aload_3
    //   202: arraylength
    //   203: istore 69
    //   205: iconst_0
    //   206: istore 70
    //   208: iload 27
    //   210: istore 71
    //   212: iload 70
    //   214: iload 69
    //   216: if_icmpge +792 -> 1008
    //   219: aload_3
    //   220: iload 70
    //   222: aaload
    //   223: invokevirtual 487	java/io/File:exists	()Z
    //   226: ifeq +768 -> 994
    //   229: iload 71
    //   231: iconst_1
    //   232: iadd
    //   233: istore 72
    //   235: goto +763 -> 998
    //   238: aload_2
    //   239: ifnull +40 -> 279
    //   242: aload_2
    //   243: arraylength
    //   244: istore 65
    //   246: iconst_0
    //   247: istore 66
    //   249: iload 27
    //   251: istore 67
    //   253: iload 66
    //   255: iload 65
    //   257: if_icmpge +768 -> 1025
    //   260: aload_2
    //   261: iload 66
    //   263: aaload
    //   264: invokevirtual 487	java/io/File:exists	()Z
    //   267: ifeq +720 -> 987
    //   270: iload 67
    //   272: iconst_1
    //   273: iadd
    //   274: istore 68
    //   276: goto +739 -> 1015
    //   279: ldc2_w 488
    //   282: iload 27
    //   284: iconst_1
    //   285: isub
    //   286: i2d
    //   287: ddiv
    //   288: dstore 28
    //   290: ldc2_w 490
    //   293: dload 28
    //   295: dadd
    //   296: dstore 30
    //   298: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   301: ifnull +14 -> 315
    //   304: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   307: dload 30
    //   309: d2i
    //   310: invokeinterface 218 2 0
    //   315: sipush 8192
    //   318: newarray byte
    //   320: astore 32
    //   322: aload_2
    //   323: ifnull +653 -> 976
    //   326: aload_2
    //   327: arraylength
    //   328: istore 56
    //   330: iload 26
    //   332: istore 57
    //   334: iconst_0
    //   335: istore 58
    //   337: iload 58
    //   339: iload 56
    //   341: if_icmpge +181 -> 522
    //   344: aload_2
    //   345: iload 58
    //   347: aaload
    //   348: astore 59
    //   350: aload 59
    //   352: invokevirtual 487	java/io/File:exists	()Z
    //   355: ifeq +614 -> 969
    //   358: ldc 12
    //   360: new 231	java/lang/StringBuilder
    //   363: dup
    //   364: invokespecial 232	java/lang/StringBuilder:<init>	()V
    //   367: ldc_w 493
    //   370: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   373: aload 59
    //   375: invokevirtual 494	java/io/File:getName	()Ljava/lang/String;
    //   378: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   381: invokevirtual 249	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   384: invokestatic 498	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;)I
    //   387: pop
    //   388: aload 4
    //   390: new 272	java/util/zip/ZipEntry
    //   393: dup
    //   394: aload 59
    //   396: invokevirtual 494	java/io/File:getName	()Ljava/lang/String;
    //   399: invokespecial 421	java/util/zip/ZipEntry:<init>	(Ljava/lang/String;)V
    //   402: invokevirtual 425	java/util/zip/ZipOutputStream:putNextEntry	(Ljava/util/zip/ZipEntry;)V
    //   405: new 262	java/io/BufferedInputStream
    //   408: dup
    //   409: new 500	java/io/FileInputStream
    //   412: dup
    //   413: aload 59
    //   415: invokespecial 503	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   418: invokespecial 265	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   421: astore 64
    //   423: aload 64
    //   425: aload 32
    //   427: invokevirtual 504	java/io/BufferedInputStream:read	([B)I
    //   430: istore 57
    //   432: iload 57
    //   434: bipush 255
    //   436: if_icmpeq +69 -> 505
    //   439: aload 4
    //   441: aload 32
    //   443: iconst_0
    //   444: iload 57
    //   446: invokevirtual 505	java/util/zip/ZipOutputStream:write	([BII)V
    //   449: goto -26 -> 423
    //   452: astore 62
    //   454: iload 57
    //   456: istore 60
    //   458: ldc 12
    //   460: aload 62
    //   462: invokevirtual 471	java/lang/Exception:getMessage	()Ljava/lang/String;
    //   465: aload 62
    //   467: invokestatic 508	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   470: pop
    //   471: dload 30
    //   473: dload 28
    //   475: dadd
    //   476: dstore 30
    //   478: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   481: ifnull +14 -> 495
    //   484: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   487: dload 30
    //   489: d2i
    //   490: invokeinterface 218 2 0
    //   495: iinc 58 1
    //   498: iload 60
    //   500: istore 57
    //   502: goto -165 -> 337
    //   505: aload 4
    //   507: invokevirtual 472	java/util/zip/ZipOutputStream:flush	()V
    //   510: aload 64
    //   512: invokevirtual 509	java/io/BufferedInputStream:close	()V
    //   515: iload 57
    //   517: istore 60
    //   519: goto -48 -> 471
    //   522: dload 30
    //   524: dstore 33
    //   526: iload 57
    //   528: istore 35
    //   530: aload_3
    //   531: ifnull +429 -> 960
    //   534: aload_3
    //   535: arraylength
    //   536: istore 43
    //   538: iconst_0
    //   539: istore 44
    //   541: iload 35
    //   543: istore 45
    //   545: iload 44
    //   547: iload 43
    //   549: if_icmpge +493 -> 1042
    //   552: aload_3
    //   553: iload 44
    //   555: aaload
    //   556: astore 49
    //   558: aload 49
    //   560: invokevirtual 487	java/io/File:exists	()Z
    //   563: ifeq +390 -> 953
    //   566: ldc 12
    //   568: new 231	java/lang/StringBuilder
    //   571: dup
    //   572: invokespecial 232	java/lang/StringBuilder:<init>	()V
    //   575: ldc_w 511
    //   578: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   581: aload 49
    //   583: invokevirtual 494	java/io/File:getName	()Ljava/lang/String;
    //   586: invokevirtual 241	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   589: invokevirtual 249	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   592: invokestatic 498	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;)I
    //   595: pop
    //   596: aload 4
    //   598: new 272	java/util/zip/ZipEntry
    //   601: dup
    //   602: aload 49
    //   604: invokevirtual 494	java/io/File:getName	()Ljava/lang/String;
    //   607: invokespecial 421	java/util/zip/ZipEntry:<init>	(Ljava/lang/String;)V
    //   610: invokevirtual 425	java/util/zip/ZipOutputStream:putNextEntry	(Ljava/util/zip/ZipEntry;)V
    //   613: new 262	java/io/BufferedInputStream
    //   616: dup
    //   617: new 500	java/io/FileInputStream
    //   620: dup
    //   621: aload 49
    //   623: invokespecial 503	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   626: invokespecial 265	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   629: astore 52
    //   631: iload 45
    //   633: pop
    //   634: aload 52
    //   636: aload 32
    //   638: invokevirtual 504	java/io/BufferedInputStream:read	([B)I
    //   641: istore 50
    //   643: iload 50
    //   645: bipush 255
    //   647: if_icmpeq +66 -> 713
    //   650: aload 4
    //   652: aload 32
    //   654: iconst_0
    //   655: iload 50
    //   657: invokevirtual 505	java/util/zip/ZipOutputStream:write	([BII)V
    //   660: goto -26 -> 634
    //   663: astore 5
    //   665: aload 5
    //   667: astore 6
    //   669: aload 4
    //   671: astore 7
    //   673: aload 7
    //   675: ifnull +13 -> 688
    //   678: aload 7
    //   680: invokevirtual 472	java/util/zip/ZipOutputStream:flush	()V
    //   683: aload 7
    //   685: invokevirtual 473	java/util/zip/ZipOutputStream:close	()V
    //   688: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   691: ifnull +19 -> 710
    //   694: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   697: bipush 100
    //   699: invokeinterface 218 2 0
    //   704: ldc2_w 474
    //   707: invokestatic 481	java/lang/Thread:sleep	(J)V
    //   710: aload 6
    //   712: athrow
    //   713: aload 4
    //   715: invokevirtual 472	java/util/zip/ZipOutputStream:flush	()V
    //   718: aload 52
    //   720: invokevirtual 509	java/io/BufferedInputStream:close	()V
    //   723: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   726: ifnull +306 -> 1032
    //   729: dload 33
    //   731: dload 28
    //   733: dadd
    //   734: dstore 54
    //   736: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   739: dload 54
    //   741: d2i
    //   742: invokeinterface 218 2 0
    //   747: dload 54
    //   749: dstore 33
    //   751: goto +281 -> 1032
    //   754: ldc2_w 512
    //   757: invokestatic 481	java/lang/Thread:sleep	(J)V
    //   760: aload 4
    //   762: ifnull +13 -> 775
    //   765: aload 4
    //   767: invokevirtual 472	java/util/zip/ZipOutputStream:flush	()V
    //   770: aload 4
    //   772: invokevirtual 473	java/util/zip/ZipOutputStream:close	()V
    //   775: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   778: ifnull +172 -> 950
    //   781: getstatic 215	com/htc/android/footprints/kml/KMLUtil:mListener	Lcom/htc/android/footprints/kml/KMLUtil$OnProgressListener;
    //   784: bipush 100
    //   786: invokeinterface 218 2 0
    //   791: ldc2_w 474
    //   794: invokestatic 481	java/lang/Thread:sleep	(J)V
    //   797: goto -614 -> 183
    //   800: astore 41
    //   802: ldc 12
    //   804: aload 41
    //   806: invokevirtual 318	java/io/IOException:getMessage	()Ljava/lang/String;
    //   809: aload 41
    //   811: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   814: pop
    //   815: goto -40 -> 775
    //   818: astore 39
    //   820: ldc 12
    //   822: aload 39
    //   824: invokevirtual 514	java/lang/InterruptedException:getMessage	()Ljava/lang/String;
    //   827: aload 39
    //   829: invokestatic 508	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   832: pop
    //   833: goto -650 -> 183
    //   836: astore 21
    //   838: ldc 12
    //   840: aload 21
    //   842: invokevirtual 318	java/io/IOException:getMessage	()Ljava/lang/String;
    //   845: aload 21
    //   847: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   850: pop
    //   851: goto -693 -> 158
    //   854: astore 17
    //   856: ldc 12
    //   858: aload 17
    //   860: invokevirtual 514	java/lang/InterruptedException:getMessage	()Ljava/lang/String;
    //   863: aload 17
    //   865: invokestatic 508	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   868: pop
    //   869: aload 13
    //   871: pop
    //   872: goto -689 -> 183
    //   875: astore 10
    //   877: ldc 12
    //   879: aload 10
    //   881: invokevirtual 318	java/io/IOException:getMessage	()Ljava/lang/String;
    //   884: aload 10
    //   886: invokestatic 324	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   889: pop
    //   890: goto -202 -> 688
    //   893: astore 8
    //   895: ldc 12
    //   897: aload 8
    //   899: invokevirtual 514	java/lang/InterruptedException:getMessage	()Ljava/lang/String;
    //   902: aload 8
    //   904: invokestatic 508	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   907: pop
    //   908: goto -198 -> 710
    //   911: astore 75
    //   913: aload 75
    //   915: astore 6
    //   917: aconst_null
    //   918: astore 7
    //   920: goto -247 -> 673
    //   923: astore 14
    //   925: aload 13
    //   927: astore 7
    //   929: aload 14
    //   931: astore 6
    //   933: goto -260 -> 673
    //   936: astore 12
    //   938: aconst_null
    //   939: astore 13
    //   941: goto -811 -> 130
    //   944: aload 13
    //   946: pop
    //   947: goto -764 -> 183
    //   950: goto -767 -> 183
    //   953: iload 45
    //   955: istore 50
    //   957: goto +75 -> 1032
    //   960: iload 35
    //   962: pop
    //   963: dload 33
    //   965: pop2
    //   966: goto -212 -> 754
    //   969: iload 57
    //   971: istore 60
    //   973: goto -478 -> 495
    //   976: dload 30
    //   978: dstore 33
    //   980: iload 26
    //   982: istore 35
    //   984: goto -454 -> 530
    //   987: iload 67
    //   989: istore 68
    //   991: goto +24 -> 1015
    //   994: iload 71
    //   996: istore 72
    //   998: iinc 70 1
    //   1001: iload 72
    //   1003: istore 71
    //   1005: goto -793 -> 212
    //   1008: iload 71
    //   1010: istore 27
    //   1012: goto -774 -> 238
    //   1015: iinc 66 1
    //   1018: iload 68
    //   1020: istore 67
    //   1022: goto -769 -> 253
    //   1025: iload 67
    //   1027: istore 27
    //   1029: goto -750 -> 279
    //   1032: iinc 44 1
    //   1035: iload 50
    //   1037: istore 45
    //   1039: goto -494 -> 545
    //   1042: dload 33
    //   1044: pop2
    //   1045: iload 45
    //   1047: pop
    //   1048: goto -294 -> 754
    //
    // Exception table:
    //   from	to	target	type
    //   10	121	124	java/lang/Exception
    //   184	388	124	java/lang/Exception
    //   458	495	124	java/lang/Exception
    //   534	660	124	java/lang/Exception
    //   713	760	124	java/lang/Exception
    //   388	449	452	java/lang/Exception
    //   505	515	452	java/lang/Exception
    //   10	121	663	finally
    //   184	388	663	finally
    //   388	449	663	finally
    //   458	495	663	finally
    //   505	515	663	finally
    //   534	660	663	finally
    //   713	760	663	finally
    //   765	775	800	java/io/IOException
    //   791	797	818	java/lang/InterruptedException
    //   148	158	836	java/io/IOException
    //   174	180	854	java/lang/InterruptedException
    //   678	688	875	java/io/IOException
    //   704	710	893	java/lang/InterruptedException
    //   0	10	911	finally
    //   130	143	923	finally
    //   0	10	936	java/lang/Exception
  }

  public static abstract interface OnProgressListener
  {
    public abstract void onEnd();

    public abstract void onProgress(int paramInt);
  }
}

/* Location:           E:\workspace\dex2java\dex-translator-0.0.9.3\HtcFootprints_dex2jar.jar
 * Qualified Name:     com.htc.android.footprints.kml.KMLUtil
 * JD-Core Version:    0.6.0
 */